home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / gnused.zip / GNUSED / CONFIGUR < prev    next >
Text File  |  1991-08-02  |  5KB  |  184 lines

  1. :
  2. # Guess values for system-dependant variables and create `Makefile'.
  3. # Copyright (C) 1991 Free Software Foundation, Inc.
  4.  
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 2, or (at your option)
  8. # any later version.
  9.  
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. # GNU General Public License for more details.
  14.  
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program; if not, write to the Free Software
  17. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  
  19. # Usage: configure [+srcdir=DIR] [+host=HOST] [+gas] [+nfp] [TARGET]
  20. # All args except +srcdir=DIR are ignored.
  21.  
  22. trap 'rm -f conftest conftest.c; exit 1' 1 3 15
  23.  
  24. set +u # Make sure unset variables are ok.
  25.  
  26. # Make sure we don't find the System V /etc/install.
  27. PATH=`echo $PATH|sed 's,^:,|,
  28. s,:$,|,
  29. s,:/usr/etc,,g
  30. s,/usr/etc:,,g
  31. s,:/etc,,g
  32. s,/etc:,,g
  33. s,|,:,g'`
  34.  
  35. # A filename unique to this package, relative to the directory that
  36. # configure is in, which we can look for to find out if srcdir is correct.
  37. unique_file=sed.c
  38.  
  39. for arg in $*; do
  40.   # Handle +srcdir with a space before the argument.
  41.   if [ x$next_srcdir = xyes ]; then srcdir=$arg; next_srcdir=
  42.   # Handle +host with a space before the argument.
  43.   elif [ x$next_host = xyes ]; then next_host=
  44.   else 
  45.     case $arg in
  46.      -srcdir=* | +srcdir=* | +srcdi=* | +srcd=* | +src=* | +sr=* | +s=*)
  47.     srcdir=`echo $arg | sed 's/[+-]s[a-z]*=//'` ;;
  48.      -srcdir | +srcdir | +srcdi | +srcd | +src | +sr | +s)
  49.     next_srcdir=yes ;;
  50.      -host=* | +host=* | +hos=* | +ho=* | +h=*) ;;
  51.      -host | +host | +hos | +ho | +h)
  52.     next_host=yes ;;
  53.      -gas | +gas | +ga | +g) ;;
  54.      -nfp | +nfp | +nf | +n) ;;
  55.      *) ;;
  56.     esac
  57.   fi
  58. done
  59.  
  60. # Find the source files, if location was not specified.
  61. if [ x$srcdir = x ]; then
  62.   srcdirdefaulted=yes; srcdir=.
  63.   if [ ! -r $unique_file ]; then srcdir=..; fi
  64. fi
  65. if [ $srcdir != . ]; then VPATH='VPATH = $(srcdir)'; fi
  66.  
  67. if [ ! -r $srcdir/$unique_file ]; then
  68.   if [ x$srcdirdefaulted = xyes ]; then
  69.     echo "$0: Can not find sources in \`.' or \`..'." 1>&2
  70.   else
  71.     echo "$0: Can not find sources in \`${srcdir}'." 1>&2
  72.   fi
  73.   exit 1
  74. fi
  75.  
  76. if test "$RANDOM" = "$RANDOM"; then
  77.   # Plain old Bourne shell.
  78.   echo checking for gcc
  79.   test -z "$CC" -a -n "`gcc 2>&1`" && CC="gcc -O"
  80.  
  81.   echo checking for install
  82.   if test -z "$INSTALL" -a -n "`install 2>&1`"; then
  83.     INSTALL="install -c"
  84.   fi
  85. else
  86.   # ksh, bash or zsh.
  87.   echo checking for gcc
  88.   test -z "$CC" && type gcc && CC="gcc -O"
  89.  
  90.   echo checking for install
  91.   if test -z "$INSTALL" && type install; then
  92.     INSTALL="install -c"
  93.   fi
  94. fi
  95.  
  96. CC=${CC-cc}
  97. INSTALL=${INSTALL-cp}
  98. INCLUDEDIR=${INCLUDEDIR-/usr/include}
  99.  
  100. rm -f conftest conftest.c
  101. compile="$CC $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1"
  102.  
  103. # Check for various header files.
  104.  
  105. echo checking for ANSI C header files
  106. echo "#include <stdlib.h>
  107. #include <string.h>
  108. main() { exit(0); strerror(0); }" > conftest.c
  109. eval $compile
  110. if test -s conftest && ./conftest 2>/dev/null; then
  111.   DEFS="$DEFS -DSTDC_HEADERS"
  112. fi
  113. rm -f conftest conftest.c
  114.  
  115. echo checking for BSD string and memory functions
  116. echo "#include <strings.h>
  117. main() { exit(0); rindex(0, 0); bzero(0, 0); }" > conftest.c
  118. eval $compile
  119. if test -s conftest && ./conftest 2>/dev/null; then :
  120.   else DEFS="$DEFS -DUSG"
  121. fi
  122. rm -f conftest conftest.c
  123.  
  124. # Check whether various functions exist.
  125.  
  126. func=vfprintf
  127. echo checking for $func
  128. echo "main() { exit(0); ${func}(); }" > conftest.c
  129. eval $compile
  130. if test -s conftest && ./conftest 2>/dev/null; then :
  131. else DEFS="$DEFS -DNO_VFPRINTF"
  132. fi
  133. rm -f conftest conftest.c
  134.  
  135. # Check other misc. things.
  136.  
  137. echo checking for unsigned characters
  138. echo 'main() { char c = 255; exit(c < 0); }' > conftest.c
  139. eval $compile
  140. if test -s conftest && ./conftest 2>/dev/null; then
  141.   DEFS="$DEFS -DCHAR_UNSIGNED"
  142. fi
  143. rm -f conftest conftest.c
  144.  
  145. echo checking how to get alloca
  146. echo '
  147. #ifdef __GNUC__
  148. #define alloca __builtin_alloca
  149. #else
  150. #ifdef sparc
  151. #include <alloca.h>
  152. #else
  153. #ifdef _AIX
  154. #pragma alloca
  155. #else
  156. char *alloca ();
  157. #endif
  158. #endif
  159. #endif
  160. main() { char *p = (char *) alloca(1); exit(0); }' > conftest.c
  161. eval $compile
  162. if test -s conftest && ./conftest 2>/dev/null; then :
  163. elif test -d /usr/ucblib; then LIBS="$LIBS -L/usr/ucblib -lucb"
  164. else LIBS="$LIBS -lPW"
  165. fi
  166. rm -f conftest conftest.c
  167.  
  168. trap 'rm -f Makefile config.status; exit 1' 1 3 15
  169.  
  170. echo '# Generated automatically from Makefile.in by configure.' > Makefile
  171. sed -e "
  172. s,@srcdir@,$srcdir,
  173. s,@VPATH@,$VPATH,
  174. s,@CC@,$CC,
  175. s,@INSTALL@,$INSTALL,
  176. s,@DEFS@,$DEFS,
  177. s,@LIBS@,$LIBS,
  178. " $srcdir/Makefile.in >> Makefile
  179.  
  180. echo "CC = $CC
  181. INSTALL = $INSTALL
  182. DEFS = $DEFS
  183. LIBS = $LIBS" > config.status
  184.